package com.zut.blocks.base.common.request;

import com.zut.blocks.base.common.CommonRequest;
import com.zut.blocks.base.domain.Course;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;

@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class CourseRequest extends CommonRequest {

    public Integer teacherId;

    public Example<Course> example() {
        Course course = new Course();
        course.setTeacherId(teacherId);
        course.setCreateTime(null);
        return Example.of(course, ExampleMatcher
                .matching()
                .withMatcher("teacherId", ExampleMatcher.GenericPropertyMatchers.exact()));
    }

}
